<template>
  <div class="box">
    <div class="top">
      <div class="title">实时游客统计</div>
      <div class="bg"></div>
      <div class="right">可预约总量<span>9999</span>人</div>
    </div>
    <div class="total">
      <span v-for="(item, index) in num" :key="index">{{ item }}</span>
    </div>
    <div class="charts" ref="charts"></div>
  </div>
</template>

<script setup lang="ts">
  import { ref, onMounted } from 'vue'
  import * as echarts from 'echarts'
  import 'echarts-liquidfill'

  let num = ref('12266人')
  let charts = ref()
  onMounted(() => {
    //获取echarts类的实例
    let myCharts = echarts.init(charts.value)
    myCharts.setOption({
      //标题组件
      // title:{
      //   text:'水球图'
      // },
      xAxis: {},
      yAxis: {},
      //系列，决定展示怎样的图形图表
      series: [
        {
          type: 'liquidFill',
          data: [0.6],
          radius: '80%',
        },
      ],
      grid: {
        left: 0,
        right: 0,
        top: 0,
        bottom: 0,
      },
    })
  })
</script>

<style scoped lang="scss">
  .box {
    background: url(../../images/dataScreen-main-lt.png) no-repeat;
    background-size: 100% 100%;
    margin-top: 10px;
    .top {
      .title {
        color: white;
        font-size: 20px;
      }
      .bg {
        background: url(../../images/dataScreen-title.png) no-repeat;
        background-size: 100% 100%;
        width: 68px;
        height: 7px;
        margin-top: 10px;
      }
      .right {
        float: right;
        color: white;
        span {
          color: yellowgreen;
        }
      }
    }
    .total {
      margin-top: 30px;
      display: flex;
      padding: 0 35px 0 35px;
      span {
        flex: 1;
        height: 60px;
        text-align: center;
        line-height: 60px;
        background: url(../../images/total.png) no-repeat;
        background-size: 100% 100%;
        color: aqua;
        font-size: 30px;
        font-weight: bold;
      }
    }
    .charts {
      width: 100%;
      height: 240px;
    }
  }
</style>
